<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
	<link type="text/css" rel="stylesheet" href="../zxy/css/emp_info/emp_communication_edit.css">
	<div id="zxy_ei_emp_commnucation_eidt_tool">
		<a id="zxy_ei_emp_commnucation_tool_save" class="easyui-linkbutton"></a>
		<a id="zxy_ei_emp_commnucation_tool_cancel" class="easyui-linkbutton"></a>
	</div>
	<div class="zxy_ece_content">
		<div class="zxy_ece_view_content">
			<table class="zxy_ece_table">
				<tbody>
					<tr>
						<td><span class="zxy_ece_table_title">电话1</span></td>
						<td><input class="zxy_ece_table_item easyui-textbox" 
								value="${emp.empCommunicationInfo.tel1 }" id="zxy_ece_tel1"></td>
					    </td>
					</tr>
					<tr>
						<td><span class="zxy_ece_table_title">电话2</span></td>
						<td><input class="zxy_ece_table_item easyui-textbox" 
								value="${emp.empCommunicationInfo.tel2 }" id="zxy_ece_tel2"></td>
					</tr>
					<tr>
						<td><span class="zxy_ece_table_title">传真</span></td>
						<td><input class="zxy_ece_table_item easyui-textbox" 
								id="zxy_ece_fax"
								value="${emp.empCommunicationInfo.fax }">
						</td>
					</tr>
					<tr>
						<td><span class="zxy_ece_table_title">电子邮件</span></td>
						<td><input class="zxy_ece_table_item easyui-textbox" 
								id="zxy_ece_email"
								value="${emp.empCommunicationInfo.email }">
						</td>
					</tr>
					<tr>
						<td><span class="zxy_ece_table_title">现住址</span></td>
						<td><input class="zxy_ece_table_item easyui-textbox" 
								id="zxy_ece_currentAddress"
								value="${emp.empCommunicationInfo.currentAddress }">
						</td>
					</tr>
					<tr>
						<td><span class="zxy_ece_table_title">紧急联系人</span></td>
						<td><input class="zxy_ece_table_item easyui-textbox" 
								id="zxy_ece_contactPerson"
								value="${emp.empCommunicationInfo.contactPerson }">
						</td>
					</tr>
					<tr>
						<td><span class="zxy_ece_table_title">紧急联系人电话</span></td>
						<td><input class="zxy_ece_table_item easyui-numberbox" 
								id="zxy_ece_contactTel"
								value="${emp.empCommunicationInfo.contactTel }">
						</td>
					</tr>	
							
				</tbody>
			</table>
		</div>
	</div>
	
	<div class="zxy_ece_content">
		<div class="zxy_ece_view_content">
			<table class="zxy_ece_table">
				<tbody>
					<tr>
						<td><span class="zxy_ece_table_title">邮政编码</span></td>
						<td><input class="zxy_ece_table_item easyui-textbox" 
								id="zxy_ece_postalCode"
								value="${emp.empCommunicationInfo.postalCode }">
						</td>
					</tr>
					<tr>
						<td><span class="zxy_ece_table_title">国家</span></td>
						<td><input class="zxy_ece_table_item easyui-textbox" 
								id="zxy_ece_country"
								value="${emp.empCommunicationInfo.country }">
						</td>
					</tr>
					<tr>
						<td><span class="zxy_ece_table_title">省</span></td>
						<td><input class="zxy_ece_table_item easyui-textbox" 
								id="zxy_ece_province"
								value="${emp.empCommunicationInfo.province }">
						</td>
					</tr>
					<tr>
						<td><span class="zxy_ece_table_title">城市</span></td>
						<td><input class="zxy_ece_table_item easyui-textbox" 
								id="zxy_ece_city"
								value="${emp.empCommunicationInfo.city }">
						</td>
					</tr>	
					<tr>
						<td><span class="zxy_ece_table_title">区</span></td>
						<td><input class="zxy_ece_table_item easyui-textbox" 
								id="zxy_ece_district"
								value="${emp.empCommunicationInfo.district }">
						</td>
					</tr>
					<tr>
						<td><span class="zxy_ece_table_title">详细地址</span></td>
						<td><input class="zxy_ece_table_item easyui-textbox" 
								id="zxy_ece_address"
								value="${emp.empCommunicationInfo.address }">
						</td>
					</tr>	
				</tbody>
			</table>
		</div>
	</div>
	
	
	
	<div id="zxy_ece_window"></div>
	
	<input type="hidden" id="zxy_ece_emp_id" value="${emp.empId }"/>
	<input type="hidden" id="zxy_ece_communication_id" value="${emp.empCommunicationInfo.id }"/>
	<script>
		var empId=$("#zxy_ei_emp_id").val();
		//获取默认值
		function zxy_ece_save_emp(){
			var address=$("#zxy_ece_address").val();
			var city=$("#zxy_ece_city").val();
			var contactPerson=$("#zxy_ece_contactPerson").val();
			var contactTel=$("#zxy_ece_contactTel").val();
			var country=$("#zxy_ece_country").val();
			var currentAddress=$("#zxy_ece_currentAddress").val();
			var district=$("#zxy_ece_district").val();
			var email=$("#zxy_ece_email").val();
			var fax=$("#zxy_ece_fax").val();
			var communicationId=$("#zxy_ece_communication_id").val();
			var postalCode=$("#zxy_ece_postalCode").val();
			var province=$("#zxy_ece_province").val();
			var street=$("#zxy_ece_street").val();
			var tel1=$("#zxy_ece_tel1").val();
			var tel2=$("#zxy_ece_tel2").val();
			console.log(address+"-"+city+"-"+contactPerson+"-"+contactTel+"-"+country+"-"+currentAddress
					+"-"+district+"-"+email+"-"+fax+"-"+communicationId+"-"+postalCode);
			$.ajax({
				url:"../emp/updateEmpCommunicationInfo",
				data:{
					address:address,
					city:city,
					contactPerson:contactPerson,
					contactTel:contactTel,
					country:country,
					currentAddress:currentAddress,
					district:district,
					email:email,
					fax:fax,
					communicationId:communicationId,
					postalCode:postalCode,
					province:province,
					street:street,
					tel1:tel1,
					tel2:tel2
				},
				success:function(data){
					if(data=="1"){
						alert("修改成功");
						$("#zxy_ei_emp_communication").panel("refresh","../emp/empCommunication?empId="+empId);
					}
					else{
						alert("修改失败");
					}
				},
				error:function(){
					alert("修改失败");
				}
			}) 
		}
		function zxy_ece_cancel_emp(){
			$("#zxy_ei_emp_communication").panel("refresh","../emp/empCommunication?empId="+empId);
		}
		//保存按钮
		$("#zxy_ei_emp_commnucation_tool_save").linkbutton({
			 iconCls:'icon-save',
			 text:'保存',
			 onClick:function(){
			    zxy_ece_save_emp();
			 }
		});
		//取消按钮
		$("#zxy_ei_emp_commnucation_tool_cancel").linkbutton({
			 iconCls:'icon-cancel',
			 text:'取消',
			 onClick:function(){
				 zxy_ece_cancel_emp();
			 }
		});
	</script>
</body>
</html>